/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ove.openmath.jome.ctrl.amto;

/**
 *
 * @author Mr.Sam
 */
import fr.ove.openmath.jome.ctrl.linear.events.LinearParserEvent;
import fr.ove.openmath.jome.ctrl.amto.AbstractMathTreeObject;

/**
* The abstract math tree object of a terminal element of an expression, such as a variable, an integer or a float,
* a specific constant (e.g. pi) which are generally reserved word in the expression.
*
* @author © 1999 DIRAT Laurent
* @version 1.0  29/10/1999
*/
public abstract class MapsToTerminal extends AbstractMathTreeObject {
    /**
    * The constructor.
    * @param identifier the identifier of the instance.
    * @param token the identifier of the instance by the mean of the event sent.
    */
    public MapsToTerminal(String identifier, int token) {
        super(identifier, token);
    }
    
    /**
    * "Flushes" the object as a sequence of events for the building of the model
    */
    public void flush() {
        LinearParserEvent linearParserEvent = new LinearParserEvent(getEventSource());
        linearParserEvent.setToken(token, param);
        fireLinearParserEvent(linearParserEvent);
    }
    
    /**
    * "Flushes" the specified child.<BR>
    * According to their father, some children need to be between parenthesis to respect correctness of the
    * expression. So, when needed, the specified child is "flushed" as if it was between parenthesis.
    * @param child the child to "flush"
    * @param index the child index in the list of children of the instance.
    */
    protected void flushChild(AbstractMathTreeObject child, int index){
        // The instance has no child
    }
}